home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 38 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.0 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: JdeBP@jba.co.uk (Jonathan de Boyne Pollard)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Name-mangling standard
  5. Date: 12 Jan 1996 11:24:37 PST
  6. Organization: JBA Software Products, Studley, England.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4d68l4$f3@silver.jba.co.uk>
  9. References: <20c.32169.607@newage.com.ar> <4bsnbu$5mu@mujibur.inmind.com> <30EDC013.7C780E5E@cims.nyu.edu> <DL1pqE.KKq@infosoft.com>
  10. Reply-To: JdeBP%utopium@jba.co.uk
  11. NNTP-Posting-Host: isolde.mti.sgi.com
  12. X-Original-Date: 12 Jan 1996 18:18:12 -0000
  13. X-Newsreader: TIN [version 1.2 PL2]
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMPa1nEy4NqrwXLNJAQGtHQH/Q8UZY1UX81FBd6Rze7V/ndc+I/q9isGw
  16.     SIzXEdjA9t3zfxwAa5mNIrIT+xXuebEQkt6ajq73auFKfl97NmFuOA==
  17.     =ZAEV
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. John Galt (jgalt@infosoft.com) wrote:
  21. : > I certainly hope not!  Name mangling is a solution to passing type
  22. : > information to 1950's linkers.  Once linkers become more sophisticated,
  23. : > name mangling can disappear back into the slime from which it came.
  24. :
  25. : I beg to differ.  Name mangling serves several indispensible functions:
  26. :
  27. : 1.  It makes it possible to have more than one function with the same name
  28. : (differing in their argument lists).  To do this without mangling, the linker
  29. : would have to see not just a function name, or even class::name, but a full
  30. : _prototype_ for each function (omitting variable names and the result type).
  31.  
  32. Why is this a problem ?  The *existing* name mangling schemes now in use
  33. carry around all of the information in the prototype (in encoded form).
  34. The only change from a "name mangling" system to an "intelligent linker"
  35. system would be that the object module format recognised by the linker
  36. would have special records to store the function signature information,
  37. rather than storing that information in the name of the function.
  38.  
  39. In other words, your implication that eliminating name mangling would
  40. require *more* information to be passed to the linker is plainly untrue.
  41.  
  42. : On systems like the PC, with multiple pointer formats, this could also be
  43. : used to check that all modules (including library code) were compiled with
  44. : the same (or compatible) memory model.  I think it is really stupid that none
  45. : of the compilers for the PC makes this possible by including the memory model
  46. : in mangled names.
  47.  
  48. What PC C++ implementations have you been using ?  All of the ones that I
  49. use (that support 16:32 pointers in addition to 0:32 pointers) include 
  50. far/near qualifications as part of the mangling scheme :
  51.  
  52. MetaWare High C++
  53. -----------------
  54. void n ( char * p )        -> n@qpc$v
  55. void n ( char _Far * p )    -> n@qpzfzc$v
  56.  
  57. Watcom C++
  58. ----------
  59. void n ( char * p )        -> W?n$n(pna)v
  60. void n ( char __far * p )    -> W?n$n(pfa)v
  61.  
  62. In other words, "quality of implementation".  Use a better implementation.
  63. Try one of the above two if you like.
  64. ---
  65. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  66.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  67.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  68.